package com.tuweiya.frontbackseparation.fbsBack.service.impl;

import com.tuweiya.frontbackseparation.fbsBack.dao.UserDAO;
import com.tuweiya.frontbackseparation.fbsBack.dto.UserDTO;
import com.tuweiya.frontbackseparation.fbsBack.entity.UserEntity;
import com.tuweiya.frontbackseparation.fbsBack.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDAO userDAO;

    @Override
    public Long saveOne(String name, String password, Long address) {
        UserEntity userEntity = new UserEntity();
        userEntity.setUserName(name);
        userEntity.setUserPassword(password);
        userEntity.setUserAddress(address);

        return userDAO.save(userEntity).getUserId();
    }
}
